load("//bazel:test.bzl", "redpanda_cc_btest", "redpanda_cc_gtest", "redpanda_test_cc_library")

redpanda_test_cc_library(
    name = "fixture",
    hdrs = [
        "fixture.h",
    ],
    implementation_deps = [
    ],
    visibility = ["//visibility:public"],
    deps = [
        "//src/v/kafka/client",
        "//src/v/kafka/client:configuration",
        "//src/v/redpanda/tests:fixture",
        "//src/v/storage/tests:disk_log_builder",
    ],
)

redpanda_test_cc_library(
    name = "utils",
    hdrs = [
        "utils.h",
    ],
    implementation_deps = [
        "//src/v/random:generators",
    ],
    visibility = ["//visibility:public"],
    deps = [
        "//src/v/reflection:adl",
        "//src/v/storage:record_batch_builder",
    ],
)

redpanda_test_cc_library(
    name = "cluster_mock",
    srcs = [
        "cluster_mock.cc",
    ],
    hdrs = [
        "cluster_mock.h",
    ],
    implementation_deps = [
        "//src/v/kafka/server:security",
        "//src/v/kafka/server:topic_config_utils",
        "//src/v/random:generators",
    ],
    visibility = ["//visibility:public"],
    deps = [
        "//src/v/cluster:topic_configuration",
        "//src/v/container:chunked_hash_map",
        "//src/v/kafka/client:brokers",
        "//src/v/kafka/client:logger",
        "//src/v/security",
    ],
)

redpanda_cc_btest(
    name = "partitioners_test",
    timeout = "short",
    srcs = [
        "partitioners.cc",
    ],
    deps = [
        "//src/v/bytes:iobuf_parser",
        "//src/v/hashing:murmur",
        "//src/v/kafka/client:partitioners",
        "//src/v/model",
        "@boost//:test",
        "@seastar//:testing",
    ],
)

redpanda_cc_btest(
    name = "fetch_session_test",
    timeout = "short",
    srcs = [
        "fetch_session.cc",
    ],
    deps = [
        ":utils",
        "//src/v/kafka/client",
        "//src/v/kafka/client:configuration",
        "//src/v/kafka/protocol",
        "//src/v/kafka/protocol:fetch",
        "//src/v/model",
        "//src/v/test_utils:seastar_boost",
        "@boost//:test",
        "@seastar//:testing",
    ],
)

redpanda_cc_btest(
    name = "produce_batcher_test",
    timeout = "short",
    srcs = [
        "produce_batcher.cc",
    ],
    deps = [
        ":utils",
        "//src/v/cluster",
        "//src/v/kafka/client",
        "//src/v/kafka/client:configuration",
        "//src/v/kafka/protocol",
        "//src/v/kafka/protocol:produce",
        "//src/v/model",
        "//src/v/reflection:adl",
        "//src/v/storage:record_batch_builder",
        "//src/v/test_utils:seastar_boost",
        "@seastar",
        "@seastar//:testing",
    ],
)

redpanda_cc_btest(
    name = "produce_partition_test",
    timeout = "short",
    srcs = [
        "produce_partition.cc",
    ],
    deps = [
        ":utils",
        "//src/v/kafka/client",
        "//src/v/kafka/client:brokers",
        "//src/v/kafka/client:configuration",
        "//src/v/kafka/protocol",
        "//src/v/kafka/protocol:produce",
        "//src/v/model",
        "//src/v/test_utils:seastar_boost",
        "@boost//:test",
        "@seastar//:testing",
    ],
)

redpanda_cc_btest(
    name = "retry_with_mitigation_test",
    timeout = "short",
    srcs = [
        "retry_with_mitigation.cc",
    ],
    deps = [
        "//src/v/kafka/client",
        "//src/v/kafka/client:utils",
        "//src/v/test_utils:seastar_boost",
        "@abseil-cpp//absl/container:flat_hash_set",
        "@boost//:test",
        "@seastar",
        "@seastar//:testing",
    ],
)

redpanda_cc_btest(
    name = "consumer_group",
    timeout = "short",
    srcs = [
        "consumer_group.cc",
    ],
    deps = [
        "//src/v/base",
        "//src/v/bytes",
        "//src/v/kafka/client",
        "//src/v/kafka/client:configuration",
        "//src/v/kafka/client/test:fixture",
        "//src/v/kafka/client/test:utils",
        "//src/v/kafka/protocol",
        "//src/v/kafka/protocol:describe_groups",
        "//src/v/kafka/protocol:fetch",
        "//src/v/kafka/protocol:find_coordinator",
        "//src/v/kafka/protocol:heartbeat",
        "//src/v/kafka/protocol:join_group",
        "//src/v/kafka/protocol:leave_group",
        "//src/v/kafka/protocol:list_groups",
        "//src/v/kafka/protocol:list_offset",
        "//src/v/kafka/protocol:metadata",
        "//src/v/kafka/protocol:offset_fetch",
        "//src/v/kafka/protocol:sync_group",
        "//src/v/kafka/protocol/schemata:join_group_request",
        "//src/v/kafka/protocol/schemata:join_group_response",
        "//src/v/kafka/protocol/schemata:offset_fetch_response",
        "//src/v/kafka/server",
        "//src/v/model",
        "//src/v/redpanda/tests:fixture",
        "//src/v/ssx:future_util",
        "//src/v/test_utils:seastar_boost",
        "//src/v/utils:unresolved_address",
        "@abseil-cpp//absl/container:flat_hash_map",
        "@boost//:test",
        "@seastar",
        "@seastar//:testing",
    ],
)

redpanda_cc_btest(
    name = "fetch",
    timeout = "short",
    srcs = [
        "fetch.cc",
    ],
    deps = [
        "//src/v/cluster",
        "//src/v/kafka/client",
        "//src/v/kafka/client:configuration",
        "//src/v/kafka/client/test:fixture",
        "//src/v/kafka/client/test:utils",
        "//src/v/kafka/protocol",
        "//src/v/kafka/protocol:fetch",
        "//src/v/kafka/protocol:metadata",
        "//src/v/model",
        "//src/v/redpanda/tests:fixture",
        "//src/v/test_utils:seastar_boost",
        "//src/v/utils:unresolved_address",
        "@boost//:test",
        "@seastar//:testing",
    ],
)

redpanda_cc_btest(
    name = "produce",
    timeout = "short",
    srcs = [
        "produce.cc",
    ],
    deps = [
        "//src/v/kafka/client",
        "//src/v/kafka/client:configuration",
        "//src/v/kafka/client:utils",
        "//src/v/kafka/client/test:fixture",
        "//src/v/kafka/client/test:utils",
        "//src/v/kafka/protocol",
        "//src/v/kafka/protocol:metadata",
        "//src/v/kafka/protocol:produce",
        "//src/v/model",
        "//src/v/redpanda/tests:fixture",
        "//src/v/test_utils:seastar_boost",
        "//src/v/utils:unresolved_address",
        "@boost//:test",
        "@seastar//:testing",
    ],
)

redpanda_cc_btest(
    name = "reconnect",
    timeout = "short",
    srcs = [
        "reconnect.cc",
    ],
    deps = [
        "//src/v/http",
        "//src/v/kafka/client",
        "//src/v/kafka/client:configuration",
        "//src/v/kafka/client:utils",
        "//src/v/kafka/client/test:fixture",
        "//src/v/kafka/client/test:utils",
        "//src/v/kafka/protocol",
        "//src/v/kafka/protocol:metadata",
        "//src/v/kafka/protocol:produce",
        "//src/v/model",
        "//src/v/pandaproxy/test:utils",
        "//src/v/redpanda/tests:fixture",
        "//src/v/test_utils:seastar_boost",
        "//src/v/utils:unresolved_address",
        "@boost//:test",
        "@seastar",
        "@seastar//:testing",
    ],
)

redpanda_cc_btest(
    name = "retry",
    timeout = "short",
    srcs = [
        "retry.cc",
    ],
    deps = [
        "//src/v/cluster",
        "//src/v/kafka/client",
        "//src/v/kafka/client:configuration",
        "//src/v/kafka/client/test:fixture",
        "//src/v/kafka/client/test:utils",
        "//src/v/kafka/protocol",
        "//src/v/model",
        "//src/v/redpanda/tests:fixture",
        "//src/v/test_utils:seastar_boost",
        "@boost//:test",
        "@seastar",
        "@seastar//:testing",
    ],
)

redpanda_cc_btest(
    name = "describe_topics",
    timeout = "short",
    srcs = [
        "describe_topics.cc",
    ],
    deps = [
        "//src/v/container:chunked_vector",
        "//src/v/kafka/client",
        "//src/v/kafka/client:configuration",
        "//src/v/kafka/client/test:fixture",
        "//src/v/kafka/client/test:utils",
        "//src/v/kafka/protocol",
        "//src/v/kafka/protocol:create_topics",
        "//src/v/kafka/protocol:describe_configs",
        "//src/v/model",
        "//src/v/redpanda/tests:fixture",
        "//src/v/test_utils:seastar_boost",
        "@boost//:test",
        "@seastar",
        "@seastar//:testing",
    ],
)

redpanda_cc_btest(
    name = "metadata",
    timeout = "short",
    srcs = [
        "metadata.cc",
    ],
    deps = [
        "//src/v/cluster",
        "//src/v/kafka/client",
        "//src/v/kafka/client/test:fixture",
        "//src/v/kafka/client/test:utils",
        "//src/v/kafka/protocol",
        "//src/v/kafka/protocol:metadata",
        "//src/v/kafka/server",
        "//src/v/kafka/server:security",
        "//src/v/model",
        "//src/v/redpanda/tests:fixture",
        "//src/v/security",
        "//src/v/test_utils:seastar_boost",
        "@boost//:test",
        "@seastar",
        "@seastar//:testing",
    ],
)

redpanda_cc_btest(
    name = "test_config_utils",
    timeout = "short",
    srcs = [
        "test_config_utils.cc",
    ],
    deps = [
        "//src/v/config",
        "//src/v/json",
        "//src/v/kafka/client",
        "//src/v/kafka/client:config_utils",
        "//src/v/kafka/client:configuration",
        "//src/v/kafka/protocol",
        "//src/v/model",
        "//src/v/redpanda/tests:fixture",
        "//src/v/security",
        "//src/v/test_utils:seastar_boost",
        "@boost//:test",
        "@seastar",
        "@seastar//:testing",
        "@yaml-cpp",
    ],
)

redpanda_cc_gtest(
    name = "utils_test",
    timeout = "short",
    srcs = [
        "utils_test.cc",
    ],
    deps = [
        "//src/v/container:chunked_vector",
        "//src/v/kafka/client:brokers",
        "//src/v/kafka/client:utils",
        "//src/v/kafka/protocol",
        "//src/v/kafka/protocol:offset_commit",
        "//src/v/model",
        "//src/v/test_utils:gtest",
        "@googletest//:gtest",
    ],
)

redpanda_cc_gtest(
    name = "topic_cache_test",
    timeout = "short",
    srcs = [
        "topic_cache_test.cc",
    ],
    deps = [
        "//src/v/container:chunked_vector",
        "//src/v/kafka/client:topic_cache",
        "//src/v/kafka/protocol:metadata",
        "//src/v/model",
        "//src/v/test_utils:gtest",
        "@googletest//:gtest",
        "@seastar",
    ],
)

redpanda_cc_btest(
    name = "list_offsets",
    timeout = "short",
    srcs = [
        "list_offsets.cc",
    ],
    deps = [
        "//src/v/container:chunked_vector",
        "//src/v/kafka/client",
        "//src/v/kafka/client/test:fixture",
        "//src/v/kafka/client/test:utils",
        "//src/v/kafka/protocol",
        "//src/v/kafka/protocol:create_topics",
        "//src/v/kafka/protocol:describe_configs",
        "//src/v/model",
        "//src/v/redpanda/tests:fixture",
        "//src/v/test_utils:seastar_boost",
        "@boost//:test",
        "@seastar",
        "@seastar//:testing",
    ],
)

redpanda_cc_gtest(
    name = "cluster_test",
    timeout = "short",
    srcs = [
        "cluster_test.cc",
    ],
    deps = [
        "//src/v/kafka/client:brokers",
        "//src/v/kafka/client:cluster",
        "//src/v/kafka/client:configuration",
        "//src/v/kafka/client:utils",
        "//src/v/kafka/data:log_reader_config",
        "//src/v/kafka/protocol",
        "//src/v/kafka/protocol:offset_commit",
        "//src/v/kafka/protocol:produce",
        "//src/v/model",
        "//src/v/redpanda/tests:fixture",
        "//src/v/storage",
        "//src/v/test_utils:gtest",
        "@googletest//:gtest",
    ],
)

redpanda_cc_gtest(
    name = "cluster_test_with_mock",
    timeout = "short",
    srcs = [
        "cluster_test_with_mock.cc",
    ],
    deps = [
        ":cluster_mock",
        "//src/v/kafka/client:brokers",
        "//src/v/kafka/client:cluster",
        "//src/v/test_utils:gtest",
        "@googletest//:gtest",
        "@seastar",
    ],
)
